"""
Name:abnerclc
Email:abnerclc@hotmail.com
Date:2024.10.12
Env:Python3.6
exserise 卖票，分10窗口
"""
import threading
from time import sleep



ticket_list=[]
for i in range(1,501):
    t = "T%s"%(i)
    ticket_list.append(t)
def sell_ticket(name):

    while len(ticket_list)>1:
        val=ticket_list.pop()

        print("%s ----%s"%(name,val))
        sleep(0.1)






def main():
    jobs = []

    for i in range(1,11):
        thread = threading.Thread(target=sell_ticket,args=("w%d"%i,))
        jobs.append(thread)
        thread.start()
    for n in jobs:
        n.join()
    print("票已卖完")
if __name__ == '__main__':
    main()